'use strict'

const Service = require('egg').Service

class LabelService extends Service {
  // 新增标签
  async createLabel(wall_id, name) {
    const { ctx, app } = this
    const result = await app.model.Wall.findOne({ where: { id: wall_id } })
    if (!result) ctx.throw(400, '墙的记录不存在')
    return app.model.Label.create({ wall_id: wall_id, name })
  }
}

module.exports = LabelService
